<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title>Insert title here</title>

<script type="text/javascript" src="./jquery1.7.js"></script>

<script type="text/javascript">
	$("#ajaxform").submit(function(e)
		{
		    var postData = $(this).serializeArray();
		    var formURL = $(this).attr("action");
		    $.ajax(
		    {
		        url : formURL,
		        type: "POST",
		        data : postData,
		        success:function(data, textStatus, jqXHR)
		        {
		            //data: return data from server
		        },
		        error: function(jqXHR, textStatus, errorThrown)
		        {
		            //if fails
		        }
		    });
		    e.preventDefault(); //STOP default action
		});

		$("#ajaxform").submit(); //Submit  the FORM
</script>

</head>

<body>
	<form name="ajaxform" id="ajaxform" action="AjaxAction.php"
		method="POST">
		First Name: <input type="text" name="fname" value="" /> <br /> Last
		Name: <input type="text" name="lname" value="" /> <br /> Email : <input
			type="text" name="email" value="" /> <br />
	</form>
	Output:
	<br>
	<button id="simple-post" class="btn btn-info">Run Code</button>
	<div id="simple-msg"></div>
</body>
</html>